﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Aj.Core
{

    public class ScriptKey
    {
        private readonly Type _type;
        private readonly string _key;
        private readonly bool _isInclude;
        internal ScriptKey(Type type, string key)
            : this(type, key, false)
        {
        }
        internal ScriptKey(Type type, string key, bool isInclude)
        {
            _type = type;
            if (string.IsNullOrEmpty(key))
            {
                key = null;
            }
            _key = key;
            _isInclude = isInclude;
        }
        public override int GetHashCode()
        {
            return Function.CombineHashCodes(Function.CombineHashCodes(_type.GetHashCode(), _key.GetHashCode()), _isInclude.GetHashCode());
        }
        public override bool Equals(object o)
        {
            ScriptKey scriptKey = o as ScriptKey;
            if (scriptKey == null) return false;

            return scriptKey._type == _type && scriptKey._key == _key && scriptKey._isInclude == _isInclude;
        }
    }
}
